﻿@{
    Layout = "~/Views/Shared/_AddEditNoButton.cshtml";
}
@section header{
    <style>
        #form1 {
            max-width: auto;
        }

        .label {
            text-align: right;
        }
    </style>
}
<div class="poppan">
    <table>
        <tr>
            <td valign="top">
                <table>
                    <tr>
                        <td class="label">宝宝姓名：</td>
                        <td>@ViewBag.data["custName"]</td>
                    </tr>
                    <tr>
                        <td class="label">联系电话：</td>
                        <td>@ViewBag.data["custTel"]</td>
                    </tr>
                    <tr>
                        <td class="label">出生日期：</td>
                        <td>@ViewBag.data["birdDate"].ToString("yyyy-MM-dd")</td>
                    </tr>
                    <tr>
                        <td class="label">宝宝小名：</td>
                        <td>@ViewBag.data["childName"]</td>
                    </tr>
                    <tr>
                        <td class="label">性别：</td>
                        <td>@ViewBag.data["sex"]</td>
                    </tr>
                    <tr>
                        <td class="label">选课情况：</td>
                        <td></td>
                    </tr>

                    <tr>
                        <td class="label">合同实收金额：</td>
                        <td>@ViewBag.data["DisPrice"]</td>
                    </tr>
                    <tr>
                        <td class="label">顾问：</td>
                        <td>@ViewBag.data["LatelyReceName"]</td>
                    </tr>
                    <tr>
                        <td class="label"> 当前选课/老师：</td>
                        <td></td>
                    </tr>
                    <tr>
                        <td class="label">课程包（合同套餐）/已上：</td>
                        <td>@ViewBag.data["SetmealName"]</td>
                    </tr>
                    <tr>
                        <td class="label">合同到期时间：</td>
                        <td>@ViewBag.data["ConEnd"]</td>
                    </tr>
                    <tr>
                        <td class="label">近6个月平均周耗课：</td>
                        <td></td>
                    </tr>
                    <tr>
                        <td class="label">活动参加：</td>
                        <td></td>
                    </tr>
                </table>
            </td>
            <td valign="top">
                待办事项
                <table class="layui-table" lay-filter="dgrid1" id="dgrid1">
                    <thead>
                        <tr>
                            <th lay-data="{field:'title',sort: true}">主题</th>
                            <th lay-data="{field:'addtime',sort: true}">任务时间</th>
                            <th lay-data="{align:'center', toolbar: '#messageBar'}">操作</th>
                        </tr>
                    </thead>
                </table>
                跟进记录
                <table class="layui-table" lay-filter="dgrid2" id="dgrid2">
                    <thead>
                        <tr>
                            <th lay-data="{field:'admode',sort: true}">跟进方式</th>
                            <th lay-data="{field:'cusgrade',sort: true}">跟进结果</th>
                            <th lay-data="{field:'remark',sort: true}">备注</th>
                        </tr>
                    </thead>
                </table>
            </td>
        </tr>
    </table>
</div>

<script type="text/html" id="messageBar">  
    <a class="layui-btn layui-btn-xs" lay-event="do">处理</a>   
</script>

@section fooler{
    <script>
        layui.use(['element', 'table', 'layer', 'laypage', 'form', 'laydate'], function () {
            //监听头工具栏事件
            var table = layui.table;
            table.init("dgrid1", {
                url: '../Customer/CustomerMore/MessageData?id=@ViewBag.id&keyCode=@ViewBag.keyCode',
                id: 'dgrid1',
                cellMinWidth: 120
            });
            table.init("dgrid2", {
                url: '../Customer/CustomerMore/FllowupData?id=@ViewBag.id&keyCode=@ViewBag.keyCode',
                id: 'dgrid2',
                cellMinWidth: 120
            });
            //监听单击
            table.on('rowDouble(dgrid2)', function (obj) {
                var data = obj.data;
                var index = layui.layer.open({
                                type: 2,
                                content: '../Customer/Fllowup?id=' + data.id + '&keyCode=' + data.keycode+'&cid=@ViewBag.id&ckeyCode=@ViewBag.keyCode',
                                title: '跟进记录',
                                area: ['360px', '450px'],
                                maxmin: true
                            });
            });
            //监听工具条
            table.on('tool(dgrid1)', function (obj) {               
                var data = obj.data;               
                if (obj.event === 'do') {
                    $.ajax({
                        type: 'POST',
                        url: '../Customer/CustomerMore/MessageDo',
                        data: {
                            id: data.id ,
                            keyCode: data.keycode,
                            t: new Date().getTime()
                        },
                        dataType: "json",
                        success: function (data) {
                            layui.layer.msg(data.message);
                            if (data.code == "0000") {
                                layui.table.reload("dgrid1");                                
                            }
                        }
                    });
                }
            });
        });

        //关闭
        function HideModal(id) {
            layui.layer.closeAll();
            layui.table.reload("dgrid");
        }
    </script>
}

